package BloodTimeHybernateDO;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Proxy;

import dao.api.DataObject;

/**
 * 
 * @author Manuel A. Quintero V.
 *
 */
@Entity
@Table(name = "ciudadarticulo")
@Proxy(lazy = false)
public class CiudadArticuloDO implements DataObject  {
	
	// -------------------------------
	// Identificador auto-incremental
	// -------------------------------
	
	private int id;
	
	
	// ------------
	// Referencias
	// ------------
	private CiudadDO ciudadId;
	private ArticuloDO articuloId;
// ------------------------------------------------------------------------
	
	public CiudadArticuloDO() {
		// Empty
	}
	
	@Override
	public void setId(int id) {
		this.id = id;
	}
	@Override
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="ciudadarticulo_sequence")
	@SequenceGenerator(sequenceName = "ciudadarticulo_sequence", name = "ciudadarticulo_sequence", allocationSize = 1)
	public int getId() {
		return id;
	}

	public void setCiudadId(CiudadDO ciudadId) {
		this.ciudadId = ciudadId;
	}
	@ManyToOne
	@Cascade( { CascadeType.ALL, CascadeType.DELETE_ORPHAN })
	public CiudadDO getCiudadId() {
		return ciudadId;
	}

	public void setArticuloId(ArticuloDO articuloId) {
		this.articuloId = articuloId;
	}
	
	@ManyToOne
	@Cascade( { CascadeType.ALL, CascadeType.DELETE_ORPHAN })
	public ArticuloDO getArticuloId() {
		return articuloId;
	}

	// ------------------------------------------------------------------------

}
